package com.yj.TemplateMethodPattern;

public class Duck implements Comparable<Duck>{
	String name;
	int weight;
	public Duck(String name, int weight) {
		super();
		this.name = name;
		this.weight = weight;
	}
	
	public String toString(){
		return name+" weighs "+weight;
	}

	@Override
	public int compareTo(Duck otherDuck) {
		
		if(this.weight< otherDuck.weight){
			return -1;
		}else if(this.weight==otherDuck.weight){
			return 0;
		}else{
			return 1;
		}
	}

	
	
}
